module.exports = function ($scope, $resource, toaster, $modalInstance, $stateParams, FileUploader, $interval, qrcode) {
  function timing() {
    if ($('#qrcode')) {
            $('#qrcode').qrcode({ 
                width: 500, 
                height: 500, 
                text: qrcode 
            });
      clearInterval(intervalProcess);
    }
  }
  var intervalProcess = setInterval(function () { timing() }, 100);
  $scope.cancel = function(){
      $modalInstance.close();
  }
  //取消
  $scope.close = function () {
      $modalInstance.dismiss('cancel');
  }

//   $scope.down = function(){
//     // downloadIamge(qrcode,"企业二维码.jpg");
//     var a = $scope.canvas.toDataURL();
//     console('a:'+a);
//   }
//   function downloadIamge(selector, name) {  
//     // 通过选择器获取img元素，  
//     var img = ""; 
//     // 将图片的src属性作为URL地址  
//     var url = img.src  
//     var a = document.createElement('a')  
//     var event = new MouseEvent('click')  
       
//     a.download = name || '下载图片名称' 
//     a.href = url  
       
//     a.dispatchEvent(event)  
// }
}  